﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UC_GioHang.ascx.cs"
    Inherits="GUI.Home.UC.UC_GioHang" %>
<%--<link href="../css/minicart.css" rel="stylesheet" type="text/css" />
<script src="../js/minicart.js" type="text/javascript"></script>--%>
<link href="Home/css/minicart.css" rel="stylesheet" type="text/css" />
<script src="Home/js/minicart.js" type="text/javascript"></script>
<div style="float: left; top: 126px;" class="mini-cart mini-cart-closed">
    <div class="tab retail collapsed retail-collapsed">
        <div class="body">
            <div class="heading">
                <a href="#" title="Close"><span>Giỏ hàng</span></a></div>
            <div class="contents">
                <table border="0" cellspacing="0" cellpadding="0">
                    <caption>
                        Giỏ hàng content</caption>
                    <colgroup>
                        <col class="image" />
                        <col class="item-name" />
                        <col class="qty" />
                        <col class="price" />
                    </colgroup>
                    <thead>
                        <tr>
                            <th>
                                Image
                            </th>
                            <th>
                                Item Name
                            </th>
                            <th>
                                Quantity
                            </th>
                            <th>
                                Price
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <% 
                            int _n = this._lstGioHang.Count;
                            for (int i = 0; i < _n; i++)
                            {
                                this._ghDTO = new DTO.GioHangDTO();
                                this._ghDTO = this._lstGioHang[i];

                                Response.Write("<tr class='even'>");
                                Response.Write("<td class='image'>");
                                Response.Write("<img src='Images\\" + this.LoadHinhAnh(this._ghDTO.MaSanPham) + "' style='width: 33px; height: 33px; border: medium none;' />");
                                Response.Write("</td>");

                                Response.Write("<td class='item-name'>");
                                Response.Write("<p><a href='ChiTietSanPham.aspx?MaSanPham=" + this._ghDTO.MaSanPham + "' target='_blank'>" + this._ghDTO.TenSanPham + "</a></p>");
                                Response.Write("</td>");

                                Response.Write("<td class='qty'>" + this._ghDTO.SoLuong + "</td>");

                                Response.Write("<td class='price'>");
                                Response.Write("<span id='Label1'>" + string.Format("{0:0,0 VNĐ}", (this._ghDTO.ThanhTien)) + "</span>");
                                Response.Write("</td>");

                            }
                        %>
                    </tbody>
                </table>
            </div>
            <div class="total">
                <div class="cart-summary">
                    <% 
                        decimal tongtien = 0;
                        Response.Write("Tổng tiền <strong>");

                        if (_n > 0)
                        {
                            for (int i = 0; i < _n; i++)
                            {
                                tongtien += this._lstGioHang[i].ThanhTien;
                            }
                        }
                        Response.Write(_n);
                        Response.Write("</strong> sản phẩm: <strong class='cart-total'>" + string.Format("{0:0,0 VNĐ}", tongtien) + "</strong>");
                            
                    %>
                </div>
            </div>
            <div class="actions">
                <ul style="font-size: 12px;">
                    <li class="view-cart"><a id="Link12" class="view-cart-button" href="GioHang.aspx">
                        Giỏ hàng</a></li>
                    <li class="checkout">
                        <asp:HyperLink ID='btnThanhToan' CssClass="checkout-button" NavigateUrl="~/ThanhToan.aspx"
                            runat="server">Thanh toan</asp:HyperLink>
                    </li>
                </ul>
            </div>
        </div>
        <div class="summary" title="Open">
            <asp:HyperLink ID="btnCart" ToolTip="Giỏ hàng của bạn" runat="server"><span class="count">
                <%
                    List<DTO.GioHangDTO> lst = new List<DTO.GioHangDTO>();
                    if (Session["GioHang"] != null)
                    {
                        lst = (List<DTO.GioHangDTO>)Session["GioHang"];
                    }
                    Response.Write("Sản phẩm " + lst.Count);
                %>       
                </span></asp:HyperLink>
        </div>
    </div>
</div>
